
*This do file generates Appendix Table A9 in the Appendix

/*Structure:
1. It opens census 1887, which is at the district level
2. It generates relevant variables for empirical anlysis
3. It generates labels
4. It runs the code to replicate Table A9 
*/

* 1. We open the dataset
use "Datasets/00_rawdata/census_1887.dta", clear

* 2. We generate relevant variables for analysis
gen male_pop1887=male_read+male_literate+male_no_read_write /*proxy for male population */
gen mcasviu_hogar60=(married60+widowed60)/hh60 /*based on 1860 census */
gen pop1887=female_pop+male_pop1887 
gen pop1887_2=pop1887^2
gen sex_ratio=male_pop1887/female_pop
gen dummy_big=(pop1887>50000)
gen female_educ=female_literate/female_pop
gen male_educ=male_literate/male_pop1887
gen pob_educ_ratio=female_educ/male_educ
egen female_literate_st=std(female_literate)

* 3. We generate labels
label variable mcasviu_hogar60 "Stem Family based on 1860 census"
label variable pop1887 "Population in 1887"
label variable pop1887_2 "Population in 1887 squared"
label variable sex_ratio "Sex ratio (male divided by female population) in 1887"
label variable female_literate "Women who can write and read in 1887"
label variable male_literate "Men who can write and read in 1887"
label variable female_educ "Share of female population that can write in 1887"
label variable male_educ "Share of male population that can write in 1887"
label variable pob_educ_ratio "Education ratio (female divided by male) in 1887"
label variable female_literate_st "Women who can write and read in 1887 (standardized)"

*Table A9: Women Literacy Rates in the Nineteenth Century by Family Type
areg female_literate_st mcasviu_hogar60 pop1887 pop1887_2 sex_ratio male_literate dummy_big, abs(ccaa) r
outreg2 using "Tables/TableA9.tex", replace dec(2) adj
areg female_educ mcasviu_hogar60 pop1887 pop1887_2 sex_ratio male_educ dummy_big, abs(ccaa) r
outreg2 using "Tables/TableA9.tex", append dec(2) adj
su female_educ if e(sample)
areg pob_educ_ratio mcasviu_hogar60 pop1887 pop1887_2 sex_ratio dummy_big, abs(ccaa) r
outreg2 using "Tables/TableA9.tex", append dec(2) adj
su pob_educ_ratio if e(sample)





















